<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-07-12 10:56:47
 * @LastEditors: 18222335065 2369811390@qq.com
 * @LastEditTime: 2022-09-06 16:44:32
-->

<!-- 文章详情页 -->
<template>
  <div>
    <Header></Header>
    <div class="center_list">
      <div class="wrapper">
        <div class="title">
          {{article.title}}
        </div>
        <div class="author">
          <span>作者:{{author.realname}}</span>
          <span>时间:{{article.publishTime | fmtDate}}</span>
          <span>阅读:{{article.readTimes}}</span>
        </div>
        <div v-html="article.content" class="list_content">
        </div>
      </div>
    </div>
    <Footer></Footer>
  </div>
</template>
<script>
import {get} from '@/utils/request';
import { fmtDate } from '../filters';
export default{
  data(){
    return{
      id:"",
      article:{},
      author:""
    }
  },
  created(){
    this.id=this.$route.query.id;
    this.getArticleById()
  },
  mounted() {
    if (location.href.indexOf("#reloaded") == -1) {
      location.href = location.href + "#reloaded";
      location.reload();
    }
  },
  methods:{
    async getArticleById(){
      let res = await get('/index/article/findById',{id:this.id});
      this.article=res.data;
      this.author=res.data.baseUser;
    }
  },
}
</script>

<style lang="scss">
  .center_list{
    .title{
      font-size: 48px;
      text-align: center;
      // color: #;
    }
    .author{
      text-align: center;
      span{
        display: inline-block;
        margin-left: 20px;
      }
    }
  }
</style>